(()=>{
    function eat(food:string){
        return food + ':太好吃了'
    }
    let str = '苹果';
    console.log(eat(str));

    console.log("********************************");
    
    //接口的方式
    interface Dog{
        name:string;
        age:number;
        color:number;
    }

    function dog_play(dog:Dog){
        return "姓名："+dog.name + "\n"
                + "年龄："+dog.age+"\n"
                + "颜色："+dog.color+"\n"
    }

    let dog = {
        name:'小白',
        age:30,
        color:1
    }
    console.log(dog_play(dog));

    console.log("********************************");
    

    //类的方式
    class Cat{
        name:string
        age:number
        color:number

        constructor(name,age,color){
            this.name = name;
            this.age = age;
            this.color = color;
        }
        cat_play(){
            return "姓名："+this.name + "\n"
                    + "年龄："+this.age+"\n"
                    + "颜色："+this.color+"\n"
        }
    }

    let cat = new Cat("大黄",29,2);
    console.log(cat.cat_play());
    console.log("*************************************");
    
})()